//package org.eden.karb.sandbox;
//
//import org.eden.karb.common.util.KarbUtils;
//import org.eden.karb.device.audio.AudioConfiguration;
//import org.eden.karb.activity.impl.sound.SoundMonitor;
//
//import javax.sound.sampled.*;
//import java.text.MessageFormat;
//
//public class Monitor {
//
//    public static void main(String[] args) {
//        Monitor activity = new Monitor();
//        //activity.printMixers();
//        activity.activity();
//    }
//
//    private void printMixers() {
//
//        Line.Info targetDLInfo = new Line.Info(TargetDataLine.class);
//        Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
//
//        System.out.println("Available mixers:");
//
//        for (Mixer.Info info : mixerInfo) {
//            Mixer currentMixer = AudioSystem.getMixer(info);
//
//            // Because this is for a recording application, we only care about audio INPUT so we just
//            // care if TargetDataLine is supported.
//            if (currentMixer.isLineSupported(targetDLInfo)) {
//                System.out.println(MessageFormat.format("[{0}]\n\tdescription: {1}\n\tvendor: {2}\n\tversion: {3}\n",
//                        info.getName(), info.getDescription(), info.getVendor(), info.getVersion()));
//            }
//        }
//    }
//
//    private void activity() {
//        Mixer.Info info = AudioSystem.getMixerInfo()[1];
//        Mixer currentMixer = AudioSystem.getMixer(info);
//
//        Line.Info targetDLInfo = new Line.Info(TargetDataLine.class);
//
//        try {
//            TargetDataLine targetRecordLine = (TargetDataLine) currentMixer.getLine(targetDLInfo);
//            targetRecordLine.open(KarbUtils.getDefaultAudioFormat());
//            targetRecordLine.start();
//
//            AudioConfiguration configuration = new AudioConfiguration();
//            configuration.setTargetRecordLine(targetRecordLine);
//            configuration.setBufferSize(500);
//            configuration.setMinimumInputLevel(5);
//
//            Thread captureThread = new SoundMonitor(configuration);
//            captureThread.start();
//        } catch (LineUnavailableException e) {
//            System.out.println(e);
//        }
//    }
//}
